<template lang="pug">
  .handdraw-mapicon.hand(v-if="hasOvvIcon" @click="goBackOvv")
    img.handdraw-mapicon-img(src="static/images/handdraw/map.gif")
</template>

<script>
import { destroyAllAudio } from '@/utils/audio'
export default {
  computed: {
    hasOvvIcon() {
      return this.$route.query && this.$route.query.draw != null
    },
    getBackUrl() {
      let url = ''
      if (this.$route.query.draw) {
        url = '/handdraw/' + this.$route.query.draw
      }
      return url
    }
  },
  methods: {
    goBackOvv() {
      this.$store.dispatch('clearLoadInfo')
      destroyAllAudio()
      this.$router.replace(this.getBackUrl)
      // 测试安卓分享后无法返回
      setTimeout(() => {
        this.$router.go(0)
      }, 100)
    }
  },
}
</script>

<style lang="stylus" scoped>
.handdraw-mapicon
  position fixed
  z-index 9999
  top 20px
  right 5px
  img.handdraw-mapicon-img
    width 38px
    height 38px

@media screen and (max-width: 768px)
  .handdraw-mapicon
    width 32px
    height 32px
    img.handdraw-mapicon-img
      width 32px
      height 32px
</style>
